

#ifndef	__ZSOCKET_MICROTIME_HPP__
#define	__ZSOCKET_MICROTIME_HPP__

#include	<time.h>
#include	<sys/time.h>

namespace	zsocket
{

struct	microtime_t	
{
public	:
	microtime_t();
	microtime_t( const struct timeval& );
	
public	:
	microtime_t&	operator=( int );
	 
	microtime_t	operator-( const microtime_t& rhs );
	microtime_t	operator+( const microtime_t& rhs );
	
	microtime_t&	operator-=( const microtime_t& rhs );
	microtime_t&	operator+=( const microtime_t& rhs );
	
	microtime_t	operator-( int );
	microtime_t	operator+( int );
	
	microtime_t&	operator-=( int );
	microtime_t&	operator+=( int );
	
	bool	operator<( const microtime_t& rhs );
	bool	operator==( const microtime_t& rhs );
	bool	operator>( const microtime_t& rhs );

	operator double ();
	
	const char*	c_str();

public	:
	time_t      m_sec;     /* seconds */
	suseconds_t m_usec;    /* microseconds */
	
private	:
	char	m_szBuf[ 32 ];
};
typedef	struct microtime_t	microtime_t;

microtime_t		microtime( void );

}	// namespace zsocket

#endif	// __ZSOCKET_MICROTIME_HPP__



